﻿using System;
using System.Text;
using SimpleHttpFramework.Http.Response;
using SimpleHttpFramework.Http.Request;

namespace SimpleHttpFramework {
    public static class Controller {
        public delegate HttpResponseBase ControllerMethod(HttpRequest request);

        public static HttpResponse Index(HttpRequest request)
        {
            var html = "";
            var base64String = Resources.Templates.index;
            html = Encoding.UTF8.GetString(Convert.FromBase64String(base64String));
            return new HttpResponse(html);
        }

        public static HttpResponse Test(HttpRequest request)
        {
            return new HttpResponse($"rawData={request.Body}\nmsg=test");
        }

        public static HttpResponse Hello(HttpRequest request)
        {
            return new HttpResponse("hello");
        }
    }
}